"Resequencing"
By Ron Schweitzer
ARCADIAN 1 no. 11 (October 31, 1979): 85,90-91. (Program Listing and Docs)
ARCADIAN 2 no. 2 (December 22, 1979): 11. (Bug Fix)

The bug fix for this program is included.

From the "Arcadian" newsletter:

"Resequencing" program by Ron Schweitzer is really a renumbering scheme to be 
used when you finish up a program and want to have a nice sequence of lines 
that are a constant interval apart (like 5, 10, 15, 20, etc).  Dick Houser has 
gone over the program and written some comments about it.


"Resequencing" Program by Ron Schweitzer

This program will renumber a Bally BASIC program and print the renumbered 
program on tape.  It will fix GOTO and GOSUB as long as they are not computed, 
i.e. GOSUB C, where the C will not be changed.  However a GOSUB 120+C will be 
changed if there is a line number 120.  It is slow, but still faster than 
editing.  This program is 473 bytes long as written here but can be shortened 
to ...

426 bytes by deleting Line 20000
377 bytes by above and deleting Line 20050
366 bytes by above and changing Line 20040 to INPUT".FL#"0,".SP"G;:PRINT
349 bytes by above and changing Line 20080 to NEXT A;PRINT ":RETURN";STOP

This program requires a "@(X)" for every line in storage. The resequence 
program is renumbered along with the object program.  Spacing between the two 
programs can be accomplished by adding some dummy lines after the object 
program.


Notes on Ron's program, by R.M. HOUSER

First key in the program of the byte length that you want.  Then dump this on a 
cassette and plan on saving it.  Now RESET the BALLY, and load the object 
program into memory from its tape.  When finished, load the "resequence" 
program after it.  This can only be done if there is enough memory space and 
you do not have a conflict in line numbers.

Now add Line    1 GOTO 20000  (GOTO 20010 if 20000 has been deleted per above)

Now push WORDS RUN GO and the CRT will show 'RUN'.  After a short wait . . .
The computer will ask for 'START NO'.  Put in 0, this will automatically set
                             'FL#'
and get rid of GOTO 20000 (or 20010) later on, and make the first line be 
0+Spacing.  At this time start the tape recorder with a new tape to load the 
renumbered program on.  The computer will now ask for 'SPACING' and enter the 
line interval you wish . . .                             '.SP'

You will now see the object program be renumbered on the CRT.  When you see 
that 
the renumbering has reached the resequence program (20000 or 20010), stop the 
tape recorder to save having to delete these lines later.

NOTE: The program stored in the Bally memory is still the old line numbered 
program, the renumbered program is on the tape.  If you now RESET the Bally and 
load the tape, you will see some garbage at the beginning that will drop out 
later when the program is run.  List the program and delete any lines of the 
resequence program.  Load the program on a clean tape.  If you have a long 
program, you will probably have to break it into two, and some of the GOTO and 
GOSUB may have to be edited by hand.  Thanks for this program, Ron.


Archive Notes:

There are two "Resequencing" programs in the archive.  One labeled "High 
Address and the other labeled "Low Address."  Paul Thacker says, "The way I 
understand it, the only difference is that one has low line numbers, and the 
other high line numbers.  So you could use the low address version if you 
wanted to resequence high line numbers.  The tape submission had both versions 
on it."
